package com.larry.mr.etl;

import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;

/**
 * @ProjectName hadoop
 * @Author larry
 * @Date 17:01 2021/11/16
 * @Description TODO    mapjoin
 **/
public class ETLMapper extends Mapper<LongWritable, Text,Text, NullWritable> {

    private Text outK = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String[] data = line.split(" ");
        for (String s : data) {
            if (s.length() > 11){
                outK.set(line);
                context.write(outK,NullWritable.get());
            }else {
                return;
            }
        }
    }
}
